﻿using System.Globalization;

namespace ConsoleApp13
{
    internal class Program
    {
        static void move(int number,char x,char y)
        {
            Console.WriteLine("把{0}从{1}移动到{2}",number, x, y);
        }
        static void tower(int total,char left,char middle,char right)
        {
                if (total == 1)
                    move(total, left, right);//从左移动到右
                else
                {
                     
                    tower(total-1, left, right, middle);//total-1在左借由右边柱子移到中间
                    move(total, left, right);//最后一个盘移到右边
                    tower(total-1, middle, left, right);//其余盘借由左边柱子移动到右边柱子
                } 
         }
        static void Main(string[] args)
        {
            int m;
            Console.WriteLine("请输入盘子个数");
            m = int.Parse(Console.ReadLine());
            tower(m,'a','b','c');
        }
    }
}